@extends('layouts.back_stage')
@section('style')
    @parent
    <style>
        #reservation{
            float:left;
        }
        .brand_id{width:150px;}
    </style>
@endsection
@section('content')
    <div class="container">
        <div style="padding: 20px 0;"><h3 >出库流向查询</h3></div>
        <div class="flow_head_box">
            <label>品牌：</label>
            <select class="address brand_id" name="brand_id">
                @if(isset($_GET['brand_id']) && $_GET['brand_id'])
                    <option value="{{ $_GET['brand_id'] }}">{{ $brands[$_GET['brand_id']] }}</option>
                    @else
                    <option value="">请选择</option>
                    @endif
                @foreach($brands as $k=>$v)
                    <option value="{{ $k }}">{{ $v }}</option>
                @endforeach
            </select>
            <label>款号：</label>
            <input type="text" style="width: 150px;display: inline-block;" name="girard"  value="{{ $infos['girard'] }}"  class="form-control girard" placeholder="输入款号">
            <label>时间：</label>
            <input class="jcDate form-control reservation_start" name="start_at"  value="{{ $infos['start_at'] }}"  style="width: 150px;display: inline-block;" placeholder="开始时间" autocomplete="off"  />
            {{--<input type="text" readonly style="width: 110px;display: inline-block" name="start_at" id="reservation" class="form-control reservation_start" autocomplete="off"  placeholder="开始时间" />--}}
            <span>-</span>
            <input class="jcDate form-control reservation_end" name="end_at"  style="width: 150px;display: inline-block;" value="{{ $infos['end_at'] }}" placeholder="结束时间" autocomplete="off"  />
            {{--<input type="text" readonly style="width: 110px;display: inline-block" name="end_at" id="reservation" class="form-control reservation_end" autocomplete="off"  placeholder="结束时间" />--}}
            <input class="btn btn-info" style="margin-bottom:3px;" type="submit" value="搜索" onclick="search_flow()">
        </div>
        <span style="display:none;" class="info_sum">{{$orde_count}}</span>
        <table  border="0" cellspacing="0" class="table table-hover" style="margin-top:20px;">
            <thead>
            <tr>
                <th>日期</th>
                <th>品牌</th>
                <th>款号</th>
                <th>颜色</th>
                <th>数量</th>
                <th>订单号</th>
                <th>流向</th>
            </tr>
            </thead>
            <tbody>
            @if(isset($orders))
                @foreach($orders as $k=>$v)
                <tr>
                    <td>{{ $v->send_at }}</td>
                    <td>{{ $brands[$v->brand_id] }}</td>
                    <td>{{ $v->girard }}</td>
                    <td>{{ $v->color }}</td>
                    <td>{{ $v->num }}</td>
                    <td>{{ $v->ordernum }}</td>
                    @if($v->is_sup)
                        <td> 由总公司发往 {{ $companys[$v->company_id] }}</td>
                        @else
                    <td>发往 {{ $v->addressee_place }}</td>
                        @endif
                </tr>
                @endforeach
                @endif

            </tbody>
        </table>
        <div style="float: right"><div style="float: right;margin:20px 0;"><button class="btn btn-info" onclick="returnPage()" style="float:right;">跳转</button><input type="text" class="form-control returnPage" style="width:6rem;float: right;margin:0 5px;"></div>{!! $orders->appends(['brand_id'=>$infos['brand_id'],'girard'=>$infos['girard'],'start_at'=>$infos['start_at'],'end_at'=>$infos['end_at']])->links() !!}</div>
    </div>
    <script  type="text/javascript">
        $(function (){
            $(".jcDate").jcDate({
                IcoClass : "jcDateIco",
                Event : "click",
                Speed : 100,
                Left : 0,
                Top : 28,
                format : "-",
                Timeout : 5000
            });
        });
        function search_flow(){
            var brand_id = $('.brand_id option:selected').val();
            var girard = $('.girard').val();
            var start_at = $('.reservation_start').val();
            var end_at = $('.reservation_end').val();
            //console.log(start_at);
            window.location.href='/admin/goods_flow?brand_id='+brand_id+'&girard='+girard+'&start_at='+start_at+'&end_at='+end_at
        }
    </script>
@endsection
@section('style')
    @parent
    <link href="{{env('CDN_DOMAIN_NAME')}}/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="{{env('CDN_DOMAIN_NAME')}}/css/jcDate.css" rel="stylesheet">
@endsection
@section('script')
    @parent
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/jQuery-jcDate.js" type="text/javascript"></script>
    <script src="https://www.jq22.com/jquery/jquery-migrate-1.2.1.min.js"></script><!--JQ的版本引导-->
@endsection